var Ajax = function(){
 	this.xmlHttpObj = null;
 	this.callBackFunction = null;
 	this.showMsg = function(grp, code){
 		var msg = getMsg("AJAX", grp, code);
 		alert(msg);
 	};
 	
	this.getHttpXmlObj = function(){

		if(window.XMLHttpRequest){
			return new XMLHttpRequest();
		}else if(window.ActiveXObject){
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
		this.showMsg("ERR","002");
 	};
 	
 	this.generateParams = function(arrParamId, arrParamValue){
 		var len = arrParamId.length;
 		var params = "";
 		while(len--){
 			params += arrParamId[len] + "=" + encodeURIComponent(arrParamValue[len])+"&" ;
 		}
 		return params.substring(0, params.length-1);
 	};
 	
 	this.doSend = function(method, url, arrParamId,arrParamValue, callback, sync){
 		
 		if(arrParamId.length!=arrParamValue.length){
 			this.showMsg("ERR","003");
 			return false;
 		}
 		
 		var params = this.generateParams(arrParamId, arrParamValue);
 		this.xmlHttpObj = this.getHttpXmlObj();
 		this.callBackFunction = callback;
 		
 		if(this.xmlHttpObj) {
 			 
 			if(method==null){
 				method = "POST";
 			}else if(method=="GET"){
 				url += ".do?" + params;
 			}else{
 				url += ".do";
 			} 
 			var ajaxThis = this;
 			this.xmlHttpObj.onreadystatechange  = function(){
 				ajaxThis.callBack.call(ajaxThis, params);  
 			};
 			
 			this.xmlHttpObj.open(method,url,true);
 			this.xmlHttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
 			this.xmlHttpObj.send(params);
 		}else{ 
 			this.showMsg("ERR","001");
 		}
 	};
 	
 	this.callBack = function(params){
 		if (this.xmlHttpObj.readyState == 4) {
 			if(this.xmlHttpObj.status == 200) {
 				eval(this.callBackFunction).call(this);
 			}else {
 	 			this.showMsg("ERR","001");
 			}
 		}
 		
 	};
 	
};
